const fs = require('fs');

// 导入解析器（需要在Node.js环境中适配）
eval(fs.readFileSync('./dbc-parser.js', 'utf8'));

const testFiles = [
    'cadillac_ct6_object.dbc',    // 科学计数法测试
    'ford_cgea1_2_ptcan_2011.dbc', // 负数测试  
    'tesla_model3_party.dbc',     // 负数范围测试
    'mazda_2017.dbc',             // VAL_定义测试
    'toyota_radar_dsu_tssp.dbc'   // 注释分号测试
];

console.log('🚀 测试主要修复...\n');

for (const filename of testFiles) {
    try {
        console.log(`测试: ${filename}`);
        const content = fs.readFileSync(filename, 'utf8');
        
        const startTime = Date.now();
        const result = parseDBCContent(content, filename);
        const duration = Date.now() - startTime;
        
        console.log(`✅ 成功! ${duration}ms | ${result.frames.length}帧 | ${result.frames.reduce((sum, f) => sum + f.signals.length, 0)}信号 | ${result.warnings.length}警告`);
        
        if (result.warnings.length > 0) {
            console.log(`   前3个警告: ${result.warnings.slice(0, 3).map(w => w.message).join(', ')}`);
        }
        
    } catch (error) {
        console.log(`❌ 失败: ${error.message}`);
    }
    console.log('');
}

console.log('测试完成!'); 